package com.go.ssh.point.service.impl;

import java.util.List;

import com.go.ssh.commons.Constants;
import com.go.ssh.commons.pagination.Page;
import com.go.ssh.commons.pagination.PageUtil;
import com.go.ssh.commons.service.impl.BaseServiceImpl;
import com.go.ssh.point.dao.IGoodsDao;
import com.go.ssh.point.model.GoodsModel;
import com.go.ssh.point.service.IGoodsService;

public class GoodsServiceImpl extends BaseServiceImpl<GoodsModel, Integer>
		implements IGoodsService {

	@Override
	public Page<GoodsModel> listAllPublished(int pn) {
		int count = getGoodsDao().countAllPublished();
		List<GoodsModel> items = getGoodsDao().listAllPublished(pn);
		return PageUtil.getPage(count, pn, items, Constants.DEFAULT_PAGE_SIZE);
	}

	IGoodsDao getGoodsDao() {
		return (IGoodsDao) getDao();
	}

}
